<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>each</title>
</head>
<body>
	each: function( obj, callback, args ) {
		var value,
			i = 0,
			length = obj.length,
			isArray = isArraylike( obj );//数组和类素组都返回真，真正的对象不行

		if ( args ) {
			if ( isArray ) {
				for ( ; i < length; i++ ) {
					value = callback.apply( obj[ i ], args );

					if ( value === false ) {
						break;
					}
				}
			} else {
				for ( i in obj ) {
					value = callback.apply( obj[ i ], args );

					if ( value === false ) {
						break;
					}
				}
			}

		// A special, fast, case for the most common use of each
		} else {
			if ( isArray ) {
				for ( ; i < length; i++ ) {
					value = callback.call( obj[ i ], i, obj[ i ] );

					if ( value === false ) {
						break;
					}
				}
			} else {
				for ( i in obj ) {
					value = callback.call( obj[ i ], i, obj[ i ] );

					if ( value === false ) {
						break;
					}
				}
			}
		}

		return obj;
	}
</body>
</html>
<script src='jquery源码分析.js'></script>
<script>
//each可以针对arguments,childNodes getElementsByTagName

	// var arr = ["a","b","c"];
	// $.each(arr,function(i , value){
	// 	alert(value);	
	// });

	var arr1 = ["e","d","f"];
	$.each(arr1,function(i,value){
		alert(this);//只会执行一次，因为有false;
		return false;
	})
</script>